<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=5EGOvGedGxhMBTyIv0Hd2HoDIO1tQDQA"></script>
<div class="modal fade" data-backdrop="static" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <%--默认的模态框标题，默认是添加操作的--%>
                <h4 class="modal-title" id="myModalLabel">登录安全验证</h4>
                <span id="loginMsg" style="font-size: 16px;color: #fab">${loginMsg}</span>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="key"><span class="iconfont icon-iconfront- "></span>关键字</label>
                    <input type="hidden" id="shopid" value="${shopId}">
                    <input type="text" class="form-control" id="key" placeholder="本次登录的关键字">
                </div>
            </div>
            <div class="modal-footer">
                <%--提示信息--%>
                <span id="msg" style="font-size: 12px;color: red"></span>
                <%--                        添加按钮--%>
                <button type="button" id="login_submit" class="btn btn-primary">
                    <span class="glyphicon glyphicon-floppy-disk"></span>记录我的本次登录</button>
            </div>
        </div>
    </div>
</div>
<%--在页面加载完之后自动导入js--%>

<script src="../statics/js/shop/login.js"></script>
<script>
    $("#login_submit").click(function () {
        var id = $("#shopid").val();
        var key = $("#key").val();
        //需要一个input记录一下 session域的
        console.log(key)
        if (key == null || key == '') {
            $("#msg").html("登录信息不能为空");
            return false
        }
        // getLocation();//不能访问
        $.ajax({
            type:"POST",
            url:"../shop/saveLoginHistory.data",
            data:{
                key: key,
                uid: id,
                pos: '河南省郑州市',
            },
            success:function (data){
                window.location.href = "${pageContext.request.contextPath}/shop/shopHome.do";
            }
        })
    });
    openLoginHis()
</script>
